Draws a picture at a place on the perspective floor (x, y on the picture) at a chosen size, nearer in front, optionally mirrored left to right. The way to give a car sizes that switch by distance.
Game Boy: not available
Game Boy Color: not available
Sega Genesis: not built yet
On other consoles this differs: see Side by side and How the consoles differ.
draw_sprite_on_floor(spr, x, y, frame, size, flip = false)| Name | Type |
|---|---|
spr | sprite |
x | real |
y | real |
frame | int |
size | real |
flip | bool (can be left out; then it is false) |
Nothing.
Draws a picture at a place on the perspective floor (x, y on the picture) at a chosen size, with the nearer picture in front. It is the way to give a car drawn sizes that switch by distance instead of scaling one big picture.
size 1 draws the picture as it is: no scaling, no turn-and-size slot, so a big near car stays sharp. 0.5 draws it half as big. To switch sizes by distance, ask floor_scale_at and pick the picture.
What each costs. A picture drawn at size 1 costs only its tiles: a 64 by 32 car is 32 of the console's 1,024 sprite tiles, a 32 by 16 one is 8, a 16 by 8 one is 2. Any other size costs the same tiles and also one of the 32 turn-and-size slots, shared by everything that turns or scales. Smooth scaling is the cheap way to write it and the dear way to run it with many cars; size steps are the other way round.
Mirroring. Give true as a last argument to mirror the picture left to right: draw_sprite_on_floor(spr_car, x, y, 2, 1, true). A car that only has right-hand leans can lean left that way. Leave it out for no mirror. A mirror at size 1 costs nothing extra: it takes no turn-and-size slot. (draw_self_on_floor mirrors by the instance's own flip, or a negative image_xscale, as draw_self does.)
The sprite's origin is its feet. Nothing is drawn when the place is behind the camera or past the horizon.
// Draw event of a rival car: three drawn sizes, none of them scaled.
var s = floor_scale_at(x, y);
if (s > 0.8) { draw_sprite_on_floor(spr_doc_glow, x, y, 0, 1); }
else if (s > 0.4) { draw_sprite_on_floor(spr_doc_glow, x, y, 0, 1); }
else if (s > 0) { draw_sprite_on_floor(spr_doc_glow, x, y, 0, 1); }Near, the big picture; farther, a smaller picture; far, the smallest. (Here all three names are the same sprite, for the example; a real car has three.)
Give true as the last argument to mirror the picture across (a car leaning left from the picture of one leaning right); leave it out for no mirror. A mirror at size 1 costs nothing extra: no turn-and-size slot. Size 1 draws the picture as it is, with no scaling and no turn-and-size slot, so a big near car stays sharp; 0.5 draws it half as big. To switch drawn sizes by distance ask floor_scale_at and pick the picture: near cars use the big sprite, farther ones a smaller sprite, all at size 1. Cost: a sprite drawn at size 1 costs only its tiles (a 64 by 32 car is 32 of the 1,024 sprite tiles, a 16 by 8 one is 2); any other size costs the same tiles and one of the 32 turn-and-size slots as well. The sprite’s origin is its feet. Nothing is drawn when the place is behind the camera or past the horizon.